#ifndef QIRCSERVICE_H
#define QIRCSERVICE_H

#include <QObject>
#include <QTcpSocket>

class QIrcService : public QObject
{
Q_OBJECT
public:
    explicit QIrcService(QObject *parent = 0);
    void connectToServer(QString server);
    void connectToServer(QString server, QString nick, QString altNickName, QString fulName, quint16 port);
    void sendCommand(QString cmd, QString param);
    void sendRawCommand(QString cmd);
    void disconnect(QString msg);

    void testProcessMessage(QString msg) { processMessage(msg); }

signals:
    void response(QString);
    void onPrivMsg(QString userOrServer, QString to, QString msg);
    void onJoinEvent(QString user, QString channel);

protected:

private:
    void processIncomingData();
    void processMessage(QString srvMessage);

private:
    QTcpSocket m_IrcClient;
    QString m_data;

    QString mServerHost;
    QString mNickName;
    QString mAltNickName;
    QString mFullName;
    quint16 mPort;

protected slots:
    void connected();
    void dataAvailable();
    void disconnected();
};

#endif // QIRCSERVICE_H
